<template>
	<div class="yellow">
		<div class="header flex a-center jlr">
			<div class="back" @click="back"><i class="iconfont icon-arrow-left-copy"></i></div>
			<h2>支付详情</h2>
			<div class="back">&nbsp;</div>
		</div>
		<div class="abox">
			<div class="orderState">
				<div v-if="payStatus == 1" class="ordericon off"></div>
				<div v-if="payStatus == 0" class="ordericon on"></div>
				<h4>{{payStatus == 1?'下单成功':'下单失败'}}</h4>
				<em>{{timer}}s</em>
			</div>

			<div class="orderGroups">
				<div class="item flex a-center jlr">
					<h4>订单号</h4>
					<p>{{orderId}}</p>
				</div>
				<div class="item flex a-center jlr">
					<h4>付款方式</h4>
					<p>{{payType == 1?'在线支付':'货到付款'}}</p>
				</div>
				<!--<div class="item flex a-center jlr">-->
					<!--<h4>付款金额</h4>-->
					<!--<p>￥1234.00</p>-->
				<!--</div>-->
			</div>
			<div class="blockbtn" style="margin-top: 1.2rem;" @click="goOrderList">确认</div>
		</div>
	</div>
</template>
<script>
export default {
	data(){
		return {
			timer:3,
      orderId: null,
      payStatus: null,
      payType: null
		}
	},
  created(){
	  this.orderId = this.$route.query.orderId;
	  this.payStatus = this.$route.query.payStatus;
	  this.payType = this.$route.query.payType;
  },
	activated(){
		var time = setInterval(()=>{
			this.timer = this.timer-1
			if(this.timer<=0){
				clearInterval(time)
        this.goOrderList();
			}
		},1000)
	},
	methods:{
		back() {
			this.$router.go(-1)
		},
    goOrderList(){
      let toPath = {
        path: '/orderlist',
        query: {
          status: 2
        }
      };
      this.$router.replace(toPath);
    }
	}
}
</script>
